def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
previousNode, currentNode = None, head
while currentNode:
temp = currentNode.next
currentNode.next = previousNode
previousNode = currentNode
currentNode = temp
return previousNode